// pages/recongnitionlist/recongnitionlist.js
let network = require("../../utils/network/network.js")
let api = require("../../utils/network/config.js").api;
const app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    indexList: [12],
    detectList: []
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    this.getDetect()
  },
  getDetect() {

    network.fetch({
        url: api.detect_list,
        inBody: false,
        data: {
          userId: 22
          //userId: getApp().globalData.userInfo.uid
        },
        method: 'GET',
      })
      .then(res => {
        console.log(res)
        let detectList = res.data
        detectList.forEach((ele, index) => {
          detectList[index].detectTime = ele.detectTime.substr(5, 11)
        });

        this.setData({
          detectList: detectList,
          scanCount: res.data.scanCount,
          orderCount: res.data.orderCount,
          stickCount: res.data.stickCount
        })
      })
  },
  gotoDetail(e) {
    wx.navigateTo({
      url: '../identifyDetail/identifyDetail?detectId=' + e.currentTarget.dataset.id,
    })
  }
})